package cn.com.cpic.insurance.rulecheck.core.rule;

import java.util.Set;

import cn.com.cpic.insurance.rulecheck.core.AbstractTagedTokenable;
import cn.com.cpic.insurance.rulecheck.core.ModifiableSet;
import cn.com.cpic.insurance.rulecheck.core.SimpleModifiableSet;
import cn.com.cpic.insurance.rulecheck.core.condition.ConditionGroup;
import cn.com.cpic.insurance.rulecheck.core.condition.SimpleConditionGroup;

/**
 * 
 * 
 * @author 代波
 * @since 2011-8-21
 */
public final class SimpleRuleGroup extends AbstractTagedTokenable<String> implements RuleGroup {
	private static final long serialVersionUID = -6047256347025726934L;

	private final ConditionGroup cg;
	private final ModifiableSet<Rule> ruleSet;

	private String name;
	private String desc;

	public SimpleRuleGroup(String token, String name, String desc, String... tags) {
		this(token, name, desc, (Set<Rule>) null, tags);
	}

	public SimpleRuleGroup(String token, String name, String desc, Set<Rule> ruleSet, String... tags) {
		this(token, name, desc, new SimpleModifiableSet<Rule>(ruleSet), tags);
	}

	public SimpleRuleGroup(String token, String name, String desc, ModifiableSet<Rule> ruleSet, String... tags) {
		super(token, tags);
		this.cg = new SimpleConditionGroup(token);
		this.ruleSet = ruleSet;
		this.name = name;
		this.desc = desc;
	}

	public ConditionGroup getCondition() {
		return cg;
	}

	public ModifiableSet<Rule> getRuleSet() {
		return ruleSet;
	}

	public String getName() {
		return name;
	}

	public String getDesc() {
		return desc;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setDesc(String desc) {
		this.desc = desc;
	}
}
